package com.internship.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.internship.dao.QuestionDao;
import com.internship.model.Question;
import com.internship.model.QuestionReply;
import com.internship.page.Page;

@Service
public class QuestionService {
	private final int PAGE_SIZE = 10;
	private final int PAGE = 7;
	@Autowired
	private QuestionDao questionDao;

	public Question getQuestionById(int Id) {
		return questionDao.getQuestionById(Id);
	}
	public Page<Question> getQuestionList(String StudentName,String DeptCode,String TeacherNumber,int pageNumber) {
		Page<Question> page = new Page<Question>(pageNumber, PAGE_SIZE);
		List<Question> list = questionDao.getQuestionList(StudentName, DeptCode, TeacherNumber, page);
		page.setResultList(list);
		return page;
	}
	public Page<Question> getMyQuestionList(String JobStudentNumber,int pageNumber) {
		Page<Question> page = new Page<Question>(pageNumber, PAGE_SIZE);
		List<Question> list = questionDao.getMyQuestionList(JobStudentNumber, page);
		page.setResultList(list);
		return page;
	}
	public Page<Question> getTeacherGuideQuestionList(String TeacherNumber,int pageNumber) {
		Page<Question> page = new Page<Question>(pageNumber, PAGE_SIZE);
		List<Question> list = questionDao.getTeacherGuideQuestionList(TeacherNumber, page);
		page.setResultList(list);
		return page;
	}
	public List<Question> getQuestionList() {
		List<Question> list = questionDao.getQuestionList();
		return list;
	}
	public List<QuestionReply> getQuestionReplyList(int QuestionId) {
		List<QuestionReply> list = questionDao.getQuestionReplyList(QuestionId);
		return list;
	}
	public int addQuestion(Question question) {
		return questionDao.addQuestion(question);
	}
	public int updateQuestion(Question question) {
		return questionDao.updateQuestion(question);
	}
	public int delQuestion(int Id) {
		return questionDao.delQuestion(Id);
	}
	public int delAll(String[] ids) {
		return questionDao.delAll(ids);
	}
	public int addQuestionReply(QuestionReply questionReply) {
		return questionDao.addQuestionReply(questionReply);
	}
	public int getQuestionCount(String DeptCode, int grade) {
		return questionDao.getQuestionCount(DeptCode, grade);
	}
	public int getQuestionUnreadCount(String DeptCode, int grade) {
		return questionDao.getQuestionUnreadCount(DeptCode, grade);
	}
	public int getHomeQuestionUnreadCount(String DeptCode, String TeacherNumber) {
		return questionDao.getHomeQuestionUnreadCount(DeptCode, TeacherNumber);
	}
	public int getQuestionReplyCount( int QuestionId) {
		return questionDao.getQuestionReplyCount(QuestionId);
	}
}
